package net.takela.common.spring.filter;

import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
 * @author baboy
 * create at 2023/1/22
 */
public class HttpRequestCachedFilter implements Filter{
    /**
     * 
     */
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    /**
     * 
     */
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (request instanceof HttpServletRequest) {
            HttpRequestCachedServlet cachedServlet = new HttpRequestCachedServlet((HttpServletRequest)request);
            chain.doFilter(cachedServlet, response);
        } else {
            chain.doFilter(request, response);
        }

    }
    /**
     * 
     */
    public void destroy() {
    }
}
